<?php

namespace App\Models;

use App\Models\Contract\SerializeDatetime;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ThirdPartyOrder extends Model
{
    use HasFactory, SerializeDatetime;

    protected $table = 'third_party_orders';

    protected $fillable = [
        'request_id',
        'media_id', 
        'user_id',
        'media_userid',
        'type',
        'data_id',
        'task_id',
        'reward',
        'reward_coins',
        'media_price',
        'reward_time',
        'remark',
        'sign',
        'project_name',
        'project_package_name',
        'project_icon',
        'task_name',
        'shop_headimgurl',
        'status',
        'processed_at'
    ];

    protected $casts = [
        'reward_time' => 'integer',
        'processed_at' => 'datetime',
    ];

    /**
     * 关联用户
     */
    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }
}
